<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>海口智慧旅游小助手</title>
    <link rel="icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
    <link href="{{ url_for('static', filename='css/apple-index.css') }}" rel="stylesheet">
    <!-- 新增交互动画样式 -->
    <link href="{{ url_for('static', filename='css/animations.css') }}" rel="stylesheet">
    <script defer src="{{ url_for('static', filename='js/apple-interactions.js') }}"></script>
    <style>
        /* 清理冗余样式 */
        .apple-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem;
        }

        .hero-section {
            border-radius: 18px;
            padding: 4rem 2rem;
            margin-bottom: 3rem;
            text-align: center;
        }

        .dynamic-text {
            font-family: var(--system-font);
            font-size: 3.5rem;
            font-weight: 700;
            letter-spacing: -0.04em;
            margin: 0 0 1rem;
        }

        .card-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
        }
    </style>
    <script src="{{ url_for('static', filename='script.js') }}" defer></script>
    <style>
        /* 恢复背景图片设置 */
        body {
            background-image: url("{{ url_for('static', filename='images/f3ce8e5b2a77015fd0225ed288c73009.jpg') }}"), linear-gradient(135deg, #6a11cb, #2575fc);
            background-size: auto, 400% 400%; /* 修改：背景图片默认平铺 */
            background-position: center, center; /* 居中显示背景图片 */
            background-repeat: repeat, no-repeat; /* 修改：背景图片平铺 */
            animation: gradient 15s ease infinite;
            min-height: 100vh;
            margin: 0;
            padding: 0;
            padding-bottom: 80px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
        }

        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        /* 统一按钮样式 */
        .btn {
            padding: 12px 24px;
            font-size: 16px;
            border-radius: 20px; /* 圆润按钮 */
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            color: white;
            border: none;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .btn-primary {
            background-color: #007bff;
        }

        .btn-orange {
            background-color: #FFA500;
        }

        .btn-secondary {
            background-color: darkblue;
        }

        /* 优化容器样式 */
        .container {
            background-color: rgba(255, 255, 255, 0.45); /* 修改：透明度降低至45% */
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
            padding: 30px;
            max-width: 80%;
            width: 100%;
            margin: 50px auto;
            max-width: 800px;
        }

        /* 优化表单组样式 */
        .form-group {
            background-color: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 30px;
            transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            max-width: 90%;
            width: 90%;
            margin: 0 auto; /* 确保居中显示 */
        }

        .form-group label {
            display: block;
            margin-bottom: 10px;
            font-weight: bold;
        }

        /* 优化下拉框样式 */
        .form-group select {
            width: 100%; /* 确保下拉框宽度自适应 */
            max-width: 100%; /* 修改：将最大宽度设置为100%，确保在小屏幕设备上占满宽度 */
            padding: 12px;
            font-size: 16px;
            border: 2px solid #007bff;
            border-radius: 15px;
            transition: border-color 0.3s ease, transform 0.3s ease;
        }

        /* 动态按钮样式 */
        button[type="submit"], button[type="button"] {
            width: 100%; /* 确保按钮宽度自适应 */
            max-width: 100%; /* 修改：将最大宽度设置为100%，确保在小屏幕设备上占满宽度 */
            padding: 12px;
            font-size: 16px;
            margin-top: 10px;
            border: none;
            border-radius: 20px; /* 圆润按钮 */
            cursor: pointer;
            transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
        }

        /* 媒体查询：针对小屏幕设备优化 */
        @media (max-width: 768px) {
            body {
                background-size: auto, 400% 400%;
                background-position: center, center;
            }

            .container {
                padding: 20px;
                margin: 30px auto;
                max-width: 100%;
            }

            .form-group {
                max-width: 100%;
                width: 100%;
            }

            /* 新增：进一步缩小表单组的宽度 */
            .form-group {
                width: 90%; /* 缩小宽度以避免超出背景 */
            }

            .form-group select, button[type="submit"], button[type="button"] {
                font-size: 14px;
                padding: 10px;
            }

            .btn {
                padding: 10px 18px;
                font-size: 14px;
            }

            /* 新增：进一步优化按钮样式 */
            .btn {
                width: 100%;
                max-width: 100%;
                margin-bottom: 10px;
            }

            /* 新增：优化标题样式 */
            h1 {
                font-size: 1.5rem;
                text-align: center;
            }

            /* 新增：优化表单组的内边距 */
            .form-group {
                padding: 15px;
            }

            /* 新增：优化按钮组的布局 */
            .form-group button {
                width: 100%;
                max-width: 100%;
                margin-bottom: 10px;
            }
        }

        /* 优化时间显示元素样式 */
        .current-time {
            position: fixed;
            top: 10px;
            left: 10px;
            font-size: 14px;
            color: white;
            background: rgba(0, 0, 0, 0.8); /* 修改：改为不透明的深色背景 */
            padding: 10px; /* 修改：增加内边距 */
            border-radius: 15px; /* 圆润时间显示 */
        }
    </style>
</head>
<body>
    <!-- 修复时间显示元素 -->
    <div class="current-time" id="currentTime"></div>

    <div class="container">
        <h1>3分钟带你玩转海口！</h1>
        <form action="/generate_route" method="post" id="routeForm">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
            <div class="form-group">
                <label for="budget">预算：</label>
                <select id="budget" name="budget">
                    <option value="1000">1000元</option>
                    <option value="2000">2000元</option>
                    <option value="3000">3000元</option>
                    <option value="4000">4000元</option>
                    <option value="5000">5000元</option>
                </select>
            </div>
            <div class="form-group">
                <label for="interest">兴趣：</label>
                <select id="interest" name="interest">
                    <option value="历史文化">历史文化</option>
                    <option value="自然风光">自然风光</option>
                    <option value="美食购物">美食购物</option>
                    <option value="综合">综合</option>
                </select>
            </div>
            <div class="form-group">
                <label for="time">时间：</label>
                <select id="time" name="time">
                    <option value="12">12小时</option>
                    <option value="24">24小时</option>
                    <option value="48">48小时以上</option>
                </select>
            </div>
            <div class="form-group">
                <label for="route_type">路线规划方式：</label>
                <select id="route_type" name="route_type">
                    <option value="riding">骑行</option>
                    <option value="driving">驾车</option>
                    <option value="walking">步行</option>
                    <option value="transit">公交</option>
                </select>
            </div>
            <div class="form-group">
                <div style="display: flex; flex-direction: column; gap: 10px;">
                    <button type="button" onclick="window.location.href='/preview'" class="btn btn-primary">数据大屏</button>
                    <button type="button" onclick="window.location.href='/city_map'" class="btn btn-orange">观摩城市</button>
                    <button type="button" onclick="window.location.href='/console'" class="btn btn-secondary">前往后台</button>
                </div>
            </div>
            <button type="submit" class="btn btn-primary">生成路线</button>
        </form>
    </div>

    <!-- 新增进度条弹窗 -->
    <div id="loading-modal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; display: none; align-items: center; justify-content: center;">
        <div style="background: white; padding: 20px; border-radius: 8px;">
            <p>您的游玩路线正在生成中，请稍等！</p>
            <div class="progress-bar" style="width: 100%; height: 10px; background: lightgray; margin-top: 10px;">
                <div class="progress" style="height: 100%; background: blue; width: 0%; animation: load 2s linear infinite;"></div>
            </div>
        </div>
    </div>

    <style>
    @keyframes load {
        0% { width: 0; }
        100% { width: 100%; }
    }
    </style>

    <script>
    document.addEventListener('DOMContentLoaded', function() {
        const form = document.getElementById('routeForm');
        const loadingModal = document.getElementById('loading-modal');

        form.addEventListener('submit', function(event) {
            event.preventDefault(); // 阻止表单默认提交行为

            // 显示进度条弹窗
            loadingModal.style.display = 'flex';

            // 模拟进度条完成后跳转
            setTimeout(function() {
                loadingModal.style.display = 'none'; // 隐藏进度条弹窗
                form.submit(); // 提交表单
            }, 2000); // 2秒后跳转
        });
    });
    </script>

    <!-- 新增：动态更新时间的 JavaScript -->
    <script>
        function updateTime() {
            const now = new Date();
            const timeString = now.toLocaleTimeString(); // 获取当前时间
            document.getElementById('currentTime').textContent = timeString;
        }

        // 每秒更新一次时间
        setInterval(updateTime, 1000);
        updateTime(); // 初始化时间显示
    </script>
</body>
</html>

</body>
</html>

    </style>

    <style>
    .form-group {
        margin-bottom: 30px;
        position: relative;
        transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    }

    .form-group:not(:last-child)::after {
        content: '';
        position: absolute;
        bottom: -18px;
        left: 50%;
        width: 92%;
        height: 1px;
        background: rgba(0, 0, 0, 0.1);
        transform: translateX(-50%);
        transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
        opacity: 0.8;
    }

    .form-group:hover {
        background-color: rgba(255, 255, 255, 0.9);
        transform: translateY(-3px);
    }
    .form-group:hover::after {
        opacity: 1;
        height: 2px;
        background: rgba(0, 0, 0, 0.15);
        bottom: -19px;
    }

    @media (max-width: 768px) {
        .form-group {
            margin-bottom: 20px;
        }
        .form-group:not(:last-child)::after {
            bottom: -10px;
            width: 98%;
            left: 1%;
            transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
        }
    }
    </style>